package com.xiaotu.constant;

/**
 * @author zhangxiao
 * @create 2021-10-15 10:49
 */
public enum BattleModeEnum {

    MACHINE(1, "人机模式"),
    PLAYER(2, "玩家模式");

    private int val;
    private String name;

    BattleModeEnum(int val, String name) {
        this.val = val;
        this.name = name;
    }

    public int getVal() {
        return this.val;
    }

    public static BattleModeEnum getBattleModeByVal(int val) {
        for (BattleModeEnum value : BattleModeEnum.values()) {
            if (value.getVal() == val) {
                return value;
            }
        }
        return null;
    }

}
